{extend name="public/layout" /}
{block name="head"}{/block}
{block name="body"}
<body>
<div class="container-fluid p-t-15">
    <form class="form-horizontal" id="form" data-url="/system/cms.class/index.html" data-refresh="1">
    <div class="row">
        <div class="col-sm-8">
            <div class="card">
                <div class="card-header">
                    <h4>添加栏目分类</h4>
                </div>
                <div class="card-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">上级分类</label>
                        <div class="col-sm-10">
                            {:\\helper\\Form::_select('pid',$Request.param.pid,[
                            "datatype"=>"*",
                            "empty-option"=>"0|===顶级分类===",
                            "items-data"=>$tree,
                            "items-key"=>"id",
                            "items-name"=>"_name"
                            ])}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">模型名称</label>
                        <div class="col-sm-10">
                            {:\\helper\\Form::_select('table_name',$table_name,[
                            "items-data"=>$table,
                            "items-key"=>"table_name",
                            "items-name"=>"display_name"
                            ])}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">分类名称</label>
                        <div class="col-sm-10">
                            {:\\helper\\Form::_text('name','',[
                            "datatype"=>"*"
                            ])}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">名称扩展</label>
                        <div class="col-sm-10">
                            {:\\helper\\Form::_text('sub_name','',[
                            "datatype"=>"*"
                            ])}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">分类图片</label>
                        <div class="col-sm-10">
                            {:\\helper\\Form::_uploadImage('pic','',[
                            "data-theme"=>"single01"
                            ])}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">关键词</label>
                        <div class="col-sm-10">
                            {:\\helper\\Form::_tags('keywords','')}
                            <p class="help-block">每个关键词输入后回车生效</p>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">描述</label>
                        <div class="col-sm-10">
                            {:\\helper\\Form::_textarea('description','')}
                        </div>
                    </div>
                    <div class="form-group" id="class-content" style="display:none;">
                        <label class="col-sm-2 control-label">内容</label>
                        <div class="col-sm-10">
                            {:\\helper\\Form::_ckeditor('class_content','')}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="card">
                <div class="card-header">
                    <h4>分类设置</h4>
                </div>
                <div class="card-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">分类类型</label>
                        <div class="col-sm-9">
                            {:\\helper\\Form::_select('class_type','',[
                            "datatype"=>"*",
                            "items-data"=>[['id'=>'0','type'=>'普通分类'],['id'=>'1','type'=>'单页面'],['id'=>'2','type'=>'外链分类']],
                            "items-key"=>"id",
                            "items-name"=>"type"
                            ])}
                        </div>
                    </div>
                    <div class="form-group" id="class-link" style="display:none;">
                        <label class="col-sm-3 control-label">链接地址</label>
                        <div class="col-sm-9">
                            {:\\helper\\Form::_text('class_url','',[])}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">列表模板</label>
                        <div class="col-sm-9">
                            {:\\helper\\Form::_select('class_tpl','',[
                            "datatype"=>"*",
                            "items-data"=>'D:cms.Class:getTplList:item_list_',
                            "items-key"=>"id",
                            "items-name"=>"name"
                            ])}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">内容模板</label>
                        <div class="col-sm-9">
                            {:\\helper\\Form::_select('content_tpl','',[
                            "datatype"=>"*",
                            "items-data"=>'D:cms.Class:getTplList:item_info_',
                            "items-key"=>"id",
                            "items-name"=>"name"
                            ])}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">是否显示</label>
                        <div class="col-sm-9">
                            {:\\helper\\Form::_switch('is_show','1')}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">排序</label>
                        <div class="col-sm-9">
                            {:\\helper\\Form::_number('show_order','0',[
                            "datatype"=>"n"
                            ])}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div style="height:60px;"></div>
    <div class="footer-bar">
        <div class="pull-right">
            <button type="button" class="btn btn-primary btn-sub"><i class="mdi mdi-content-save"></i> 保存</button>
            <button type="button" class="btn btn-danger" onclick="helper.closeCurrent()"><i class="mdi mdi-close"></i> 关闭</button>
        </div>
        <div class="pull-right m-r-15">
            <p class="error-msg"></p>
        </div>
    </div>
    </form>
</div>
<script>
    formHelper.init();
    formHelper.subForm();
    $('select[name="class_type"]').change(function () {
        var value = $('select[name="class_type"] option:selected').val();
        if(value==0){
            $('#class-content').hide();
            $('#class-link').hide();
        }
        if(value==1){
            $('#class-content').show();
            $('#class-link').hide();
        }
        if(value==2){
            $('#class-content').hide();
            $('#class-link').show();
        }
    })
</script>
</body>
{/block}